package com.ptswitch.material.pages.bom;

import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.ptswitch.material.pages.base.PageBase;
import com.ptswitch.material.service.BomService;
import com.ptswitch.material.util.HlogConstants;
import com.ptswitch.material.util.security.PermissionUtil;

public class ClearBom extends PageBase {
    @Inject
    private BomService bomSer;
    @InjectPage
    private ListBom listBom;

    @OnEvent(value = EventConstants.ACTIVATE)
    public Object clear() {
        checkPermitted(PermissionUtil.BomClear);
        bomSer.deleteAll();
        hlog(HlogConstants.deleteAllBom);
        return listBom;
    }

}
